package com.heima.user.controller;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.entity.ApUser;
import com.heima.user.service.ApUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/v1/user")
public class ApUserController {

    @Resource
    private ApUserService apUserService;

    @GetMapping("/{id}")
    public ResponseResult<ApUser> findById(@PathVariable Long id){

        ApUser apUser = apUserService.getById(id);
        apUser.setPassword(null);
        apUser.setSalt(null);
        return ResponseResult.okResult(apUser);
    }
}
